package com.dongdongshop.mq;

import com.dongdongshop.data.Result;
import com.dongdongshop.enums.ResultEnums;
import org.apache.rocketmq.spring.core.RocketMQTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Component
@RequestMapping("mq")
public class Producer {

    //rocketMQTemplate
    @Autowired
    private RocketMQTemplate rocketMQTemplate;

    @ResponseBody
    @RequestMapping("sendmessage")
    public Result sendmessage(String sendmessage){
        rocketMQTemplate.convertAndSend("ggws",sendmessage);
        return Result.response(ResultEnums.SUCCESS);
    }
}
